//
//  UIBarButtonItem+Extension.swift
//  glzbowei
//
//  Created by 高伦展 on 2018/2/24.
//  Copyright © 2018年 glz. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    ///便利构造函数
    /// imageName:图片名
    /// target:监听对象
    /// actionName:监听图像名
    /// returns:UIBarButtonItem
    convenience init(imageName:String,target:Any?,actionName:String?) {
        
        let button  = UIButton(imgName: imageName, bgImgName: nil)
        
        if let actionName = actionName {
            button.addTarget(target, action: Selector(actionName), for: .touchUpInside)
        }
        
        self.init(customView:button)
    }
}
